package cn.zt.ztzx.controller;

import cn.zt.utils.Result;
import cn.zt.ztzx.domain.dto.DeviceDto;
import cn.zt.ztzx.service.DeviceService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("admin/device")
public class DeviceController {
    @Resource
    private DeviceService deviceService;
    //查询所有
    @GetMapping("DeviceList")
    public Result DeviceList(DeviceDto deviceDto) {
        return deviceService.deviceList(deviceDto);
    }
    //添加
    @PostMapping("addDevice")
    public Result addDevice(@RequestBody DeviceDto deviceDto) {
        return deviceService.deviceSave(deviceDto);
    }
    //删除
    @DeleteMapping("deviceDelete")
    public Result deviceDelete(Integer id) {
        return deviceService.deviceDelete(id);
    }
    //修改
    @PutMapping("deviceUpdate")
    public Result deviceUpdate(@RequestBody DeviceDto deviceDto) {
        return deviceService.deviceUpdate(deviceDto);
    }
}
